<?php

class Zend_View_Helper_MenuItem extends Zend_View_Helper_Abstract
{
    public $view;

    public function menuItem($label,$resource,$target,$par = array())
    {
        $params = array(
            'id'       => $resource,
            'name'     => $label,
            'url'      => '/'. str_replace('.','/',$resource),
            'target'   => $target,
            'disabled' => isset($this->view->resources[$resource]) ? 'enabled' : 'disabled',
            'bookmark' => isset($this->view->bookmarks[$resource]) ? 'bookmark' : '',
        );
        foreach ($par as $k => $v)
            $params['url'] = $params['url'] . '/' . $k . '/' . $v;
        return $this->view->partial('MenuItem.phtml', $params);
    }

    public function setView(Zend_View_Interface $view)
    {
        $this->view = $view;
    }
}
?>
